

const Layout = requirePlugin('Layout').default;


function isNotNullObject(obj){
    if (obj == null){
        return false;
    }
    return typeof obj == "object";
}


function main(){
    console.log("===>开放域开始.....")
    wx.onMessage(data=>{
        if (!isNotNullObject(data)){
            console.error("data为null,或者不是一个对象");
            return;
        }

        if(!("command" in data)){
            console.error("data 没有command 属性.");
            return;
        }

        let command = data.command;
        switch (command){
            case "showRank":
                console.log("准备showRank");
                break;
            case "hideRank":
                console.log("准备hideRank");
                break;
            default:
                console.error("unknow command:" + command);
                break;
        }
    });
}
main();